<template>
	<view class="container">
		<!-- 建议放在外层 -->
		<view class="head_bg" @click.stop="selectMedia" :style="backgroundImage">
			<view class="title_layout">
				<view class="title_layout-2">
					<image class="return-icon"
						src="https://dnsverify.pfmoto.com/appstatic/img/my/my_personal_return_white.png"
						@click.stop="goBack">
						<image v-if="!orther" class="edit-icon wechaticon"
							src="https://dnsverify.pfmoto.com/appstatic/img/my/my_personal_edit_white.png"
							@click.stop="myEdit">
				</view>
			</view>
			<view class="headView" @click.stop="previewHeaderImage">
				<image class="headIcon" @error="imgerror"
					:src="userInfo&&userInfo.userimages||'https://dnsverify.pfmoto.com/appstatic/my/my_icon_avatar_unlogin.png'">
					<!-- 六期认证功能 -->
					<block>
						<!-- 账户被认证，头像下面有认证标识，头像旁边有获得的徽章，最右边有认证的达人名称，如果没被认证，最右边有认证入口 -->
						<!-- <image class="headLogo"
							src="https://dnsverify.pfmoto.com/appstatic/my/my_icon_avatar_bottom.png"></image> -->
						<image class="badge_image" v-if="userInfo.isUseBadge==0&&userInfo.badgeImg" 
							:src="userInfo.badgeImg" @click.stop="toMyBadge"></image>
						<view @click.stop="toExpertCertification"
							v-if="(!orther &&showMaster==true&& !(userInfo.officialTalentName!=undefined&&userInfo.officialTalentName!=null&&userInfo.officialTalentName!=''))||  (orther && !(userInfo.officialTalentName!=undefined&&userInfo.officialTalentName!=null&&userInfo.officialTalentName!='')) ">
							<image class="expertCertification_image" src="@appstatic/my/expert_chuangzuo_1.png"
								v-if="masterName=='创作达人'"> </image>
							<image class="expertCertification_image" src="@appstatic/my/expert_daihuo_1.png"
								v-else-if="masterName=='带货达人'"> </image>
							<image class="expertCertification_image" src="@appstatic/my/expert_zhishi_1.png"
								v-else-if="masterName=='知识达人'"> </image>
							<image class="expertCertification_image" src="@appstatic/my/expert_gongchuang_1.png"
								v-else-if="masterName=='共创达人'"> </image>
							<image class="expertCertification_image" src="@appstatic/my/expert_qixing_1.png"
								v-else-if="masterName=='骑行达人'"> </image>
						</view>

						<text class="expertCertification_btn" @click.stop="toExpertCertification"
							v-else-if='!orther'>达人认证</text>
					</block>

			</view>
		</view>

		<!-- #ifdef APP-PLUS||H5 -->
		<u-sticky id="sticky" customNavHeight='0px' offsetTop="0px" fixed="fixed">
			<view class="new_head_bg" :style="fixed">
				<view class="title_layout">
					<view class="title_layout-2">
						<view class="layout-personal-info">
							<image v-if="headShowReturn==false" class="return-icon"
								src="https://dnsverify.pfmoto.com/appstatic/img/my/my_personal_return_black.png"
								@click="goBack"></image>


							<!-- 六期认证功能 -->
							<block>
								<image class="authentication_1"
									v-if="headShowReturn==false&&userInfo.officialTalentName!=undefined&&userInfo.officialTalentName!=null&&userInfo.officialTalentName!=''"
									src="https://dnsverify.pfmoto.com/appstatic/img/my/my_authentication_1.png">
							</block>


							<view class='text-1' v-if="userInfo.wechatName==''||userInfo.wechatName==null">
								<view v-if="userInfo.phone==null||userInfo.phone==undefined">
									已注销用户
								</view>
								<view v-else>
									{{userInfo.phone.substr(0, 3) + '*****' + userInfo.phone.substr(8)}}
								</view>
							</view>
							<view class='text-1 maxWidth' v-else>{{userInfo.wechatName}}</view>


							<!-- 六期认证功能 -->
							<block>
								<block
									v-if="headShowReturn==true&&userInfo.officialTalentName!=undefined&&userInfo.officialTalentName!=null&&userInfo.officialTalentName!=''">
									<image class=" authentication_1"
										src="https://dnsverify.pfmoto.com/appstatic/img/my/my_authentication_1.png">
									</image>
									<!-- 认证用户 -->
									<view class="text-2">{{userInfo.officialTalentName}}</view>
								</block>

								<block v-if="headShowReturn==false">
									<image class="badge_image1" :src="userInfo.badgeImg" @click.stop="toMyBadge"
										v-if="userInfo.isUseBadge==0&&userInfo.badgeImg" />

									<view
										v-if="(!orther &&showMaster==true)||  (orther && !(userInfo.officialTalentName!=undefined&&userInfo.officialTalentName!=null&&userInfo.officialTalentName!=''))"
										@click.stop="toExpertCertification">
										<image class="expertCertification_image1"
											src="@appstatic/my/expert_chuangzuo_2.png" v-if="masterName=='创作达人'">
										</image>
										<image class="expertCertification_image1"
											src="@appstatic/my/expert_daihuo_2.png" v-else-if="masterName=='带货达人'">
										</image>
										<image class="expertCertification_image1"
											src="@appstatic/my/expert_zhishi_2.png" v-else-if="masterName=='知识达人'">
										</image>
										<image class="expertCertification_image1"
											src="@appstatic/my/expert_gongchuang_2.png" v-else-if="masterName=='共创达人'">
										</image>
										<image class="expertCertification_image1"
											src="@appstatic/my/expert_qixing_2.png" v-else-if="masterName=='骑行达人'">
										</image>

									</view>

								</block>
							</block>

						</view>

						<image v-if="headShowReturn==false&&!orther" class="edit-icon"
							src="https://dnsverify.pfmoto.com/appstatic/img/my/my_personal_edit_black.png"
							@click="myEdit">
					</view>



					<view class="content_layout" v-if="headShowReturn==true" id="content_layout">

						<view class="modal_layout" @click.stop="gotoFollowing">
							<view class="text-4">{{myFocusCount}}</view>
							<view class="text-5">关注</view>
						</view>
						<view class="text-5">/</view>
						<view class="modal_layout" @click.stop="gotoFollower">
							<view class="text-4">{{focusMeCount}}</view>
							<view class="text-5">粉丝</view>
						</view>
						<view class="text-5">/</view>
						<view class="modal_layout">
							<view class="text-4">{{thumbsNum}}</view>
							<view class="text-5">点赞</view>
						</view>
					</view>

				</view>
			</view>

		</u-sticky>
		<!-- #endif -->

		<!-- #ifdef MP-WEIXIN -->
		<u-sticky customNavHeight='0px' offsetTop="0px" fixed="fixed">
			<Sticky id="sticky" :fixed='fixed' :userInfo="userInfo" :myFocusCount="myFocusCount"
				:focusMeCount="focusMeCount" :thumbsNum="thumbsNum" :headShowReturn='headShowReturn'
				@gotoFollowing="gotoFollowing" @gotoFollower="gotoFollower" @goBack="goBack" @myEdit="myEdit"></Sticky>
		</u-sticky>
		<!-- #endif -->

		<view>
			<block v-for="(item, index) in communtyList" :key="index">
				<view :data-id="item.id" :data-item="item" @click.stop="enterDetail(item)">
					<view class="layout-row" style="justify-content: space-between;">
						<view class="modal_layout">
							<view class="text-6">{{(item.publishTime).slice(8,10)}}</view>
							<view class="text-7">{{(item.publishTime).slice(0,4)}}年{{(item.publishTime).slice(5,7)}}月
							</view>
						</view>

						<image v-if="!orther" src="https://dnsverify.pfmoto.com/appstatic/img/my/my_del_icon.png"
							class="closeBtn" @click.stop="deleteAction(item)">
						</image>
					</view>
					
					<view class="date-line">
						<view class="layout-column">
							<view class="text-8" v-if="item.subType==1">{{item.content}}</view>
							<view class="text-8" v-else>{{item.titleArticle}}</view>
							
							<view v-if="item.subType==6" style="display: flex;flex-direction: row;align-items: center;padding-bottom: 20rpx;">
								<text style="padding-right: 20rpx;">{{item.isOfficial===0?'用户活动':'官方活动'}}</text>
								<image v-if="item.activityType=='骑行活动'" class="activityType" src="https://dnsverify.pfmoto.com/appstatic/community/text_activity_cycle.png"></image>
								<image v-else class="activityType" src="https://dnsverify.pfmoto.com/appstatic/community/text_activity_signup.png"></image>
							</view>
							
							<image
								v-if="item.subType!=1&&item.webpublishCoverArticle!=null&&item.webpublishCoverArticle!=''&&item.webpublishCoverArticle!=undefined"
								class="image_one" :src="item.webpublishCoverArticle" mode='widthFix'>

								<view v-else>
									<!-- 视频 -->
									<view class="videoView" v-if="item.typeTrend == 2&&item.imgList.length !=0"
										@tap.stop="stop">
										<r-video :autoplay="false" :poster="item.poster" :loop="true"
											style="height: 400rpx;width: 580rpx;" :src="item.imgList[0]">
										</r-video>
									</view>
									<!-- 图片 -->
									<view v-else class="media-wraper">
										<view
											:class="(item.imgList.length === 1 ? '': 'img-box') +  ' img-box' + item.imgList.length">
											<view class='img-item' v-for='(img_item, ind) in item.imgList' :key='ind'>
												<image @click.stop="previewImage(item.imgList,ind)" :src="img_item"
													mode="aspectFill">
												</image>
											</view>
										</view>
									</view>
								</view>
								<view v-if="item.subType == 4&&item.cover_">
									<image @click.stop="previewImage([item.cover_],0)" :src="item.cover_"
										mode="widthFix">
									</image>
								</view>
								<!-- 标签 -->
								<view class="topic" v-if="item.topicList.length">
									<view class="topic-item" v-for="(v,indx) in item.topicList" :key="indx"
										@click.stop="enternTopicDetail(v.id)">
										<image src="https://dnsverify.pfmoto.com/appstatic/community/topic-icon.png"
											mode="aspectFill">
										</image>
										<text>{{v.topicName||""}}</text>
									</view>

								</view>

								<view v-if="item.subType==6" class="layout-row" style="margin-top:8px;margin-left: 0px;margin-bottom: 16px;">
									<text class="footer-date">{{item.activityCity}} | {{item.publishTime}} 开始报名</text>
								</view>
								
								<view v-else class="layout-row" style="margin-top:8px;margin-left: 0px;margin-bottom: 16px;">
									<view class="layout-row" style="margin-left: 0px;">
										<image class="small-icon"
											src="https://dnsverify.pfmoto.com/appstatic/img/my/my_see_icon.png">
											<view class="text-5">{{item.viewsNum||'0'}}</view>
									</view>
									<view class="layout-row" style="margin-left: 10px;">
										<image class="small-icon" @click.stop="thumbCommuntyTouched(item)"
											v-if="item.isThumbs"
											src="https://dnsverify.pfmoto.com/appstatic/community/ac-1-off.png"
											mode="aspectFill">
										</image>
										<image class="small-icon" @click.stop="thumbCommuntyTouched(item)" v-else
											src="https://dnsverify.pfmoto.com/appstatic/community/ac-1.png"
											mode="aspectFill">
										</image>
										<view class="text-5"> {{item.thumbsNum||'0'}}</view>
									</view>
									<view class="layout-row" style="margin-left: 10px;">
										<image class="small-icon"
											src="https://dnsverify.pfmoto.com/appstatic/img/my/my_comment_icon.png">
											<view class="text-5"> {{item.commentNum||'0'}}</view>
									</view>
								</view>
						</view>
					</view>
				</view>
			</block>
			<!-- 动态结束 -->
			<view class="noMore" v-if="pagination.loadMore == false">
				<text>没有更多数据了</text>
			</view>
		</view>
		<clxDialog :isShow='show' @dialogConfirm='dialogConfirm' @dialogCancel='dialogCancel' :title="title">
		</clxDialog>
	</view>
</template>

<script>
	const app = getApp();
	const util = require("@utils/util.js");
	const network = require("@manager/network-manager.js");
	const dialog = require("@utils/dialog.js");
	import UploadView from '@/components/UploadView/UploadView.vue'
	import uniCell from '@/components/uni-cell.vue';
	import clxDialog from "@/components/clx-dialog/clx-dialog";
	import Sticky from '@/components/sticky/sticky';
	export default {
		data() {
			return {
				userInfo: null,
				headShowReturn: true,
				refresherEnabled: false,
				fixed: {
					'border-top-left-radius': '10px',
					'border-top-right-radius': '10px',
					'height': '100px'
				},
				backgroundImage: 'background-image: url(https://dnsverify.pfmoto.com/appstatic/img/my/my_personal_head_bg.png)',
				triggered: false,
				focusMeCount: 0,
				myFocusCount: 0,
				thumbsNum: 0,
				title: '确认删除该条动态?',
				show: false,
				delItem: '',
				pagination: {
					loadMore: true,
					page: 1,
					totalPage: 1,
					limit: 10,
					length: 100
				},
				scrollY: false,
				communtyList: [],

				openScreen: false,
				myVideo: '',
				// flag:false
				thumbFlag: false,
				orther: '',
				showMaster: false,
				masterName: ''
			}
		},

		components: {
			Sticky,
			uniCell,
			clxDialog
		},


		onPageScroll(e) {
			// 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
			this.scrollTop = e.scrollTop;
			var that = this;
			uni.createSelectorQuery().select('#sticky').boundingClientRect(function(rect) {

				var top = rect.top;
				if (top == 0) {
					that.scrollY = true

					//  } else if (top < 10) {  
				} else {
					that.scrollY = false
					if (top < 1) {
						// that.scrollY = true
						that.headShowReturn = false
						that.fixed = {
							'border-top-left-radius': '0px',
							'border-top-right-radius': ' 0px',
							'height': '85px'
						}
						//  } else if (top < 10) {  
					} else if (top < 30) {
						// that.scrollY = false
						that.headShowReturn = false
						that.fixed = {
							'border-top-left-radius': '10px',
							'border-top-right-radius': '10px',
							'height': '85px'
						}
					} else {
						// that.scrollY = false
						that.headShowReturn = true
						that.fixed = {
							'border-top-left-radius': '10px',
							'border-top-right-radius': ' 10px',
							'height': '100px'
						}
					}

				}

			}).exec();
		},


		onReachBottom() {
			this.onreachBottomMore()
		},

		onLoad: function(options) {
			if (options.item) {
				this.orther = JSON.parse(options.item)
				if(this.orther.authorId == app.getUserId()){
					this.orther=''
				}
			}
			console.log(this.orther)
		},
		onShow: function() {
			// console.log(app.globalData.userInfo,'====================')
			if (this.orther) {
				this.userInfo = this.orther
				if (!this.userInfo.userimages || this.userInfo.userimages.length == 0) {
					this.userInfo.userimages =
						'https://dnsverify.pfmoto.com/appstatic/my/my_icon_avatar_unlogin.png';
				}
				this.userInfo.coverImg = this.userInfo.coverImg ? this.userInfo.coverImg :
					"https://dnsverify.pfmoto.com/appstatic/img/my/my_personal_head_bg.png"
				this.backgroundImage = 'background-image:  url(' + this.userInfo.coverImg + ')'

				this.masterName = this.userInfo.expertName
			} else {
				var user = uni.getStorageSync('UserInfo');
				if (user && user.id) {
					this.userInfo = app.globalData.userInfo
					if (!this.userInfo.userimages || this.userInfo.userimages.length == 0) {
						this.userInfo.userimages =
							'https://dnsverify.pfmoto.com/appstatic/my/my_icon_avatar_unlogin.png';
					}
					this.userInfo.coverImg = this.userInfo.coverImg ? this.userInfo.coverImg :
						"https://dnsverify.pfmoto.com/appstatic/img/my/my_personal_head_bg.png"
					this.backgroundImage = 'background-image:  url(' + this.userInfo.coverImg + ')'


				} else {
					this.userInfo = {
						'userimages': 'https://dnsverify.pfmoto.com/appstatic/my/my_icon_avatar_unlogin.png'
					}
				}


				this.getUserMasterShow()
			}

			this.loadCommunityData()
			this.loadCommunityList()
			// this.getUserMasterShow()


		},
		methods: {
			//查用户对外展示的达人认证
			getUserMasterShow: function() {
				var that = this;
				var uri = app.globalData.config.interfaces.URL_ACTIVITY_USERMASTER_GETUSERMASTERSHOW;
				var params = {
					userId: app.getUserId()
				};
				network.get(uri, params, 'form').then(res => {
					if (res.code == 200) {
						if (res.message == '操作成功' && res.data.masterName != undefined && res.data
							.masterName != null && res.data.masterName != '') {
							that.showMaster = true
							that.masterName = res.data.masterName
						}
					} else {
						// uni.showToast({
						// 	title: res.message,
						// 	duration: 3000,
						// 	icon: 'none'
						// })
					}
				}).catch(res => {
					// uni.showToast({
					// 	title: res.errMsg,
					// 	duration: 3000,
					// 	icon: 'none'
					// })
				});

			},
			//图片加载错误默认图
			imgerror: function() {
				var _this = this
				_this.userInfo.userimages = "https://dnsverify.pfmoto.com/appstatic/my/my_icon_avatar_unlogin.png"
			},
			goBack: function() {
				wx.navigateBack({
					delta: 1
				})
			},
			//跳转我的勋章
			toMyBadge: function() {
				if (!this.orther) {
					// #ifdef APP-PLUS||H5
					uni.navigateTo({
						url: '/module_my/pages/myBadge/myBadge'
					});
					// #endif
					// #ifdef MP-WEIXIN
					this.selectMedia()
					// #endif
				}
			},
			//跳转达人认证
			toExpertCertification: function() {
				if (!this.orther) {
					// #ifdef APP-PLUS||H5
					uni.navigateTo({
						url: '/module_my/pages/expertCertification/expertCertification'
					});
					// #endif
					// #ifdef MP-WEIXIN
					this.selectMedia()
					// #endif
				} 
			},

			//自定义下拉刷新被复位
			onRestore: function() {
				// this.triggered = 'restore'; // 需要重置

				var that = this;
				if (!this.triggered) {
					this.triggered = true; //下拉加载，先让其变true再变false才能关闭
					//关闭加载状态 (转动的圈)，需要一点延时才能关闭
					setTimeout(e => {
						that.triggered = false;
					}, 300)
				}






				console.log("结束")
			},
			//自定义下拉刷新被中止
			onAbort: function() {
				if (this.pagination.loadMore) {
					//loadmore为true:底部显示loading,为false,显示"没有更多了"
					this.loadCommunityList(false);
				}
				this.triggered = false
			},
			//没有更多了
			onreachBottomMore: function() {
				if (this.pagination.loadMore) {
					//loadmore为true:底部显示loading,为false,显示"没有更多了"
					this.loadCommunityList(false);
				}
			},
			//改背景图
			selectMedia: function() {
				if (this.orther) {
					return
				}
				var that = this;
				uni.chooseImage({
					count: 1,
					sourceType: ['camera', 'album'],
					sizeType: ["compressed"],
					success(response) {
						var fileUrl = response.tempFilePaths[0]
						that.choseImage(fileUrl);
					}
				})
			},
			choseImage: function(fileUrl) {

				// 选择图片后, 返回的数据
				var uploadUrl = app.globalData.config.BASE_URL + app.globalData
					.config.interfaces.URL_ALIYUN_OSS_UPLOAD
				uni.uploadFile({
					url: uploadUrl, //仅为示例，非真实的接口地址
					filePath: fileUrl,
					name: 'file',
					formData: {
						'user': 'test'
					},
					header: {
						"token": "Bearer " + app.globalData.token,
						"Authorization": "Bearer " + app.globalData.token
					},
					success: (uploadFileRes) => {
						var uploadFileData = JSON.parse(uploadFileRes
							.data);
						var datapath = uploadFileData.data

						if (uploadFileData.code == 200) {
							var save_uri = app.globalData.config.interfaces
								.URL_ADMIN_UPDATEUSERINFO;
							var save_params = {
								"id": app.globalData.userInfo.id + '',
								"coverImg": datapath
							};

							network.put(save_uri, save_params, 'json')
								.then(res => {
									if (res.code == 200) {
										uni.showToast({
											title: res.message,
											duration: 3000,
											icon: 'none'
										})
										app.globalData.userInfo.coverImg = datapath;
										app.saveUser(app.globalData.userInfo)
										this.backgroundImage = 'background-image:  url(' + this
											.userInfo.coverImg + ')'


									} else {
										uni.showToast({
											title: res.message,
											duration: 3000,
											icon: 'none'
										})
									}
								}).catch(res => {
									uni.showToast({
										title: res.errMsg,
										duration: 3000,
										icon: 'none'
									})
									console.error(res);
								});
						} else {
							uni.showToast({
								title: "上传失败" + uploadFileData.message,
								duration: 3000,
								icon: 'none'
							})

						}


					}
				});
			},
			//浏览大图
			previewHeaderImage: function() {
				uni.previewImage({
					urls: [this.userInfo.userimages ||
						'https://dnsverify.pfmoto.com/appstatic/my/my_icon_avatar_unlogin.png'
					],
					current: '0', // 当前显示图片的http链接，默认是第一个
				});
			},
			//删除弹窗
			deleteAction: function(data) {

				if (data.subType == 1) {
					this.title = "确认删除该条动态"
				} else if (data.subType == 2 || data.subType == 3) {
					this.title = "确认删除该条文章"
				}else if (data.subType == 6){
					this.title = "确认删除该条活动"
				}
				 else {
					this.title = "确认删除该条问答"
				}


				this.show = true;
				this.delItem = data
			},
			//确定
			dialogConfirm(e) {
				this.show = false
				this.onConfirm(this.delItem)
			},
			//取消
			dialogCancel() {
				this.show = false
				this.delItem = ""
			},
			//确认删除
			onConfirm: function(item) {
				var that = this;

				if (item.subType == 4) {
					var uri = app.globalData.config.interfaces.URL_ASK_UPDATE;
					var params = {
						id: item.id,
						delFlag: true
					};
					network.post(uri, params, 'json').then(res => {
						uni.stopPullDownRefresh();
						if (res.code == 200) {
							uni.showToast({
								title: '删除成功',
								duration: 3000,
								icon: 'none'
							})
							that.loadCommunityList(true)
						} else {
							uni.showToast({
								title: res.message,
								duration: 3000,
								icon: 'none'
							})
						}
					}).catch(res => {
						console.error(res, 'err')

						uni.showToast({
							title: res.errMsg,
							duration: 3000,
							icon: 'none'
						})
						console.error(res);

					});
				}else if(item.subType == 6){//活动
					var uri = app.globalData.config.interfaces.URL_APP_UPDATESTATUSPARTY;
					var params = {
						id: item.id,
					};
					network.post(uri, params, 'form').then(res => {
						uni.stopPullDownRefresh();
						if (res.code == 200) {
							uni.showToast({
								title: '删除成功',
								duration: 3000,
								icon: 'none'
							})
							that.loadCommunityList(true)
						} else {
							uni.showToast({
								title: res.message,
								duration: 3000,
								icon: 'none'
							})
						}
					}).catch(res => {
						console.error(res, 'err')
					
						uni.showToast({
							title: res.errMsg,
							duration: 3000,
							icon: 'none'
						})
						console.error(res);
					
					});
				} else {
					var uri = app.globalData.config.interfaces.URL_DEL_PERSONAL_COMMUNITY;
					var params = {
						"id": item.id,
						"loginId": app.getUserId(),
						"key": 2,
						"value": 1


					};
					console.log(params + "!!!!!")


					network.post(uri, params, 'form').then(res => {
						uni.stopPullDownRefresh();
						if (res.code == 200) {
							uni.showToast({
								title: '删除成功',
								duration: 3000,
								icon: 'none'
							})
							this.loadCommunityList(true)
						} else {
							uni.showToast({
								title: res.message,
								duration: 3000,
								icon: 'none'
							})
						}
					}).catch(res => {
						console.error(res, 'err')
						uni.stopPullDownRefresh();
						uni.showToast({
							title: res.errMsg,
							duration: 3000,
							icon: 'none'
						})
						console.error(res);

					});
				}


			},
			//点击进入详情
			enterDetail: function(item) {

				if (item.subType == '1') {
					var url = '/module_community/pages/moments/detail/detail?id=' + item.id
				} else if (item.subType == '2' || item.subType == '3') {
					var url = '/module_community/pages/article/detail/detail?id=' + item.id
				}else if(item.subType == '6'){
					var url = '/module_community/pages/activity/detail/detail?id=' + item.id
				} else {
					var url = '/module_community/pages/questionAndAnswer/detail/detail?id=' + item.id
				}

				uni.navigateTo({
					url: url,
					fail(err) {
						console.log(err, 'err')
					}
				});
			},
			//浏览大图
			previewImage: function(list, index) {

				var imgList = JSON.parse(JSON.stringify(list))
				let imageConfig = '?x-oss-process=image/resize,m_lfit,w_700'
				for (let i = 0; i < imgList.length; i++) {

					imgList[i] = imgList[i] + imageConfig
				}
				uni.previewImage({
					current: index,
					urls: imgList,
				});
			},
			//跳转我的关注
			gotoFollowing: function() {
				uni.navigateTo({
					url: '../following?loginId=' + this.orther.authorId
				})
			},
			//跳转粉丝
			gotoFollower: function() {

				uni.navigateTo({
					url: '../follower?loginId=' + this.orther.authorId
				})
			},

			//改变视频状态-全屏
			screenChange: function(index) {
				this.myVideo = uni.createVideoContext('myVideo' + index);
				if (this.openScreen == false) {
					this.myVideo.requestFullScreen()
					this.openScreen = true
				} else {
					this.myVideo.exitFullScreen()
					this.openScreen = false;
				}
			},


			//播放
			videoPlay: function(src) {
				uni.navigateTo({
					url: '/module_my/pages/videoDetail/videoDetail?src=' + src
				})
			},
			//个人主页统计数据
			loadCommunityData: function() {

				var that = this;
				var uri = app.globalData.config.interfaces.URL_GET_PERSONAL_COMMUNITY_DATA;
				var loginId
				if (this.orther && this.orther.authorId) {
					loginId = this.orther.authorId
				} else {
					loginId = app.getUserId()
				}
				var params = {
					"loginId": loginId
				};
				console.log(params, 'params')
				network.get(uri, params, 'form').then(res => {
					if (res.code == 200) {
						that.myFocusCount = res.data.myFocusCount
						that.focusMeCount = res.data.focusMeCount
						that.thumbsNum = res.data.thumbsNum
					} else {
						uni.showToast({
							title: res.message,
							duration: 3000,
							icon: 'none'
						})
					}
				}).catch(res => {
					console.error(res, 'err')
					uni.showToast({
						title: res.errMsg,
						duration: 3000,
						icon: 'none'
					})
				});
			},
			imgMatch(str) {
				var data = '';
				str.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/, function(match, capture) {
					data = capture;
				});
				return data
			},
			//个人主页列表
			loadCommunityList: function(isRefresh) {

				var that = this;
				var uri = app.globalData.config.interfaces.URL_GET_PERSONAL_COMMUNITY;
				var loginId
				if (this.orther && this.orther.authorId) {
					loginId = this.orther.authorId
				} else {
					loginId = app.getUserId()
				}
				var params = {
					"loginId": loginId,
					"pageNum": isRefresh ? 1 : that.pagination.page,
					"pageSize": that.pagination.limit

				};
				console.log(params, 'params')
				network.get(uri, params, 'form', null, true).then(res => {
					uni.stopPullDownRefresh();
					if (res.code == 200) {
						var _list = res.data.list;
						_list.map(item => {
							item.cover_ = that.imgMatch(item.content)
							item.content = item.content.replace(/<img .*?>/g, "");
						})
						var pagination = that.pagination;
						if (isRefresh) {
							that.communtyList = _list
						} else {
							if (_list && _list.length > 0) {
								that.communtyList = [...that.communtyList, ..._list]
							}
						}
						var loadMore = true;

						if (pagination.page >= res.data.totalPage) {
							loadMore = false;
						} else {
							loadMore = true;
						}
						that.pagination.loadMore = loadMore
						this.pagination.page = pagination.page + 1
					} else {
						uni.showToast({
							title: res.message,
							duration: 3000,
							icon: 'none'
						})
					}
				}).catch(res => {
					console.error(res, 'err')
					uni.stopPullDownRefresh();
					uni.showToast({
						title: res.errMsg,
						duration: 3000,
						icon: 'none'
					})
					console.error(res);

				});
			},



			//编辑信息
			myEdit: function() {
				uni.navigateTo({
					url: '../myEdit/myEdit'
				});
			},

			//点赞社区动态
			thumbCommuntyTouched: function(item) {
				var that = this
				if (util.isLogin(getApp())) {
					if (this.thumbFlag) {
						return
					}
					this.thumbFlag = true
					var detail = item
					var uri = app.globalData.config.interfaces.URL_COMMUNTIY_THUMB;
					var thumbsFlag
					detail.isThumbs == 0 ? thumbsFlag = 1 : thumbsFlag = 0
					var params = {
						"id": item.id,
						"loginId": app.getUserId(),
						"isfrom": 2,
						"thumbsFlag": thumbsFlag
					};
					if (item.subType == 4) {
						uri = app.globalData.config.interfaces.URL_ACTIVITY_UPDATEASKTHUMBS

						network.post(uri, params, 'form').then(res => {
							if (res.code == 200) {
								item.thumbsNum = item.thumbsNum + (!item.isThumbs ? 1 : -1);
								item.isThumbs = !item.isThumbs;
							} else {
								uni.showToast({
									title: res.message,
									duration: 3000,
									icon: 'none'
								})
							}
							that.thumbFlag = false
						}).catch(res => {
							that.thumbFlag = false
							uni.showToast({
								title: res.errMsg,
								duration: 3000,
								icon: 'none'
							})
							console.error(res);
						});
					} else {
						network.post(uri, params, 'form').then(res => {
							if (res.code == 200) {
								item.thumbsNum = item.thumbsNum + (!item.isThumbs ? 1 : -1);
								item.isThumbs = !item.isThumbs;
							} else {
								uni.showToast({
									title: res.message,
									duration: 3000,
									icon: 'none'
								})
							}
							that.thumbFlag = false
						}).catch(res => {
							that.thumbFlag = false
							uni.showToast({
								title: res.errMsg,
								duration: 3000,
								icon: 'none'
							})
							console.error(res);
						});
					}

				} else {
					util.jumpLogin();
				}
			},
			//跳话题
			enternTopicDetail(id) {
				uni.navigateTo({
					url: '/module_community/pages/topic/detail/detail?id=' + id,
					fail(err) {
						console.log(err, 'err')
					}
				});
			},



		}
	}
</script>

<style>
	@import "./personalCenter.css";
	.activityType {
		width: 122rpx;
		height: 40rpx;
		padding-right: 10rpx;
	}
	.footer-date {
		font-size: 28rpx;
		line-height: 32rpx;
		color: #ADB0AE;
		flex: 1;
	}
</style>
